package com.opennews.openplatform.config;

import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationFeature;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

public class AppConfig {
    public ObjectMapper createObjectMapper() {
        // Creates a new ObjectMapper
        ObjectMapper objectMapper = new ObjectMapper();

        // Registers the JavaTimeModule to handle LocalDateTime and other Java 8 time types
        objectMapper.registerModule(new JavaTimeModule());

        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        return objectMapper;
    }
}